﻿using RPAVIEW.util;
using RPAVIEW.views.controlLibrary;
using System.Windows;
using System.Windows.Controls;

namespace RPAVIEW.views.EditPage.flows.CopyExcelN {
    /// <summary>
    /// Input.xaml 的交互逻辑
    /// </summary>
    public partial class Input:BaseParamViewAction{
        public Input() {
            InitializeComponent();
        }

        public override void UpdateSource() {
            this.copyObject.GetBindingExpression(SelVarTextBox.text).UpdateSource();
            this.copyWay.GetBindingExpression(ComboBox.SelectedIndexProperty).UpdateSource();
            this.row.GetBindingExpression(SelVarTextBox.text).UpdateSource();
            this.column.GetBindingExpression(SelVarTextBox.text).UpdateSource();
            this.endRow.GetBindingExpression(SelVarTextBox.text).UpdateSource();
            this.endColumn.GetBindingExpression(SelVarTextBox.text).UpdateSource();
            this.sheetName.GetBindingExpression(SelVarTextBox.text).UpdateSource();
        }

        private void CopyWayChanged(object sender, SelectionChangedEventArgs e) {
            int copyWay = this.copyWay.SelectedIndex;
            switch (copyWay) { 
                case 0: { 
                    //区域
                    ElementUtil.ShowRow(this.beginTiprow);
                    ElementUtil.ShowRow(this.endTiprow);
                    ElementUtil.ShowRow(this.rowrow);
                    ElementUtil.ShowRow(this.columnrow);
                    ElementUtil.ShowRow(this.endrowrow);
                    ElementUtil.ShowRow(this.endcolumnrow);
                    break;    
                } 
                case 1: { 
                    //列
                    ElementUtil.HideRow(this.beginTiprow);
                    ElementUtil.HideRow(this.rowrow);
                    ElementUtil.ShowRow(this.columnrow);
                    ElementUtil.HideRow(this.endTiprow);
                    ElementUtil.HideRow(this.endrowrow);
                    ElementUtil.HideRow(this.endcolumnrow);
                    break;    
                } 
                case 2: {
                    //行
                    ElementUtil.HideRow(this.beginTiprow);
                    ElementUtil.ShowRow(this.rowrow);
                    ElementUtil.HideRow(this.columnrow);
                    ElementUtil.HideRow(this.endTiprow);
                    ElementUtil.HideRow(this.endrowrow);
                    ElementUtil.HideRow(this.endcolumnrow);
                    break;    
                } 
                case 3: { 
                    //单元格
                    ElementUtil.HideRow(this.beginTiprow);
                    ElementUtil.ShowRow(this.rowrow);
                    ElementUtil.ShowRow(this.columnrow);
                    ElementUtil.HideRow(this.endTiprow);
                    ElementUtil.HideRow(this.endrowrow);
                    ElementUtil.HideRow(this.endcolumnrow);
                    break;    
                } 
                case 4: { 
                    ElementUtil.HideRow(this.beginTiprow);
                    ElementUtil.HideRow(this.rowrow);
                    ElementUtil.HideRow(this.columnrow);
                    ElementUtil.HideRow(this.endTiprow);
                    ElementUtil.HideRow(this.endrowrow);
                    ElementUtil.HideRow(this.endcolumnrow);
                    break;    
                } 
                default: break;
            }
        }
    }
}
